<div class="grid_5">
<ol class="list">
<h3>Threads</h3><?php foreach($threads->result() as $result) { ?>
<li>
<p><?=$result->count?> designs // <?=anchor('designs/thread/' . $result->id . '/' . $result->count, 'latest')?></p>
<h4><?=anchor('designs/thread/' . $result->id, $result->name)?></h4>
</li>
<?php } ?>
</ol>
</div>
<div class="grid_4">
<h3>Latest Comments</h3>
<ol class="list">
<?php foreach($comments->result() as $row) { ?>
	<li>
	<p>By <?=$row->fname?></p>
	<h4>
		<a href="designs/thread/<?=$row->thread?>/<?=$row->version?>"><?=strip_tags(word_limiter($row->body, '5'));?></a>
	</h4>
	</li>
<?php } ?>
</ol>
</div>
<div class="grid_7">
<h3>Upload a Design</h3>
<?php foreach($error as $err) {
	echo $err;
	};?>
	<?php if($threads->num_rows() == 0)
		{
		echo '<div class="error">You have to start a thread before you can upload a design</div>';
		}
		else { ?>
<?php echo form_open_multipart('designs/do_upload');?>
<ul>
<li><label>Design</label><input type="file" name="image" size="20" /></li>
<li><label>Thread</label>

		<select name="thread">

	<?php foreach($threads->result() as $result) { ?>
	<option value="<?=$result->id?>"><?=$result->name?></option>
	<?php } ?>
	</select>
</li>
<li><input type="submit" class="submit" value="upload" /></li>
</ul>
</form>
<?php } ?>
<h3>Start a New Design Thread</h3>
<?php echo form_open('designs/do_newthread');?>
<ul>
<li><label>Thread title</label><input type="text" name="title" /></li>
<li><input type="submit" class="submit" value="Start thread" /></li>
</ul>
</form>
</div>